// var bcrypt = require('bcrypt');
var Waterline = require('waterline');

// 股票集合
var stockCollection = Waterline.Collection.extend({
    identity: 'stock',
    connection: 'default',
    attributes: {
        id: {
            type: 'integer',
            primaryKey: true,
            unique: true,
            required: true,
            autoIncrement: true,
            defaultsTo: function() {
                return 0;
            }
        },
        timeStamp:  {
            type: 'datetime',
            unique: true,
            required: true
        },
        // Add a reference to capital
        capital: {
            collection: 'capital',
            via: 'utcTime'
        }
    },
    afterUpdate: function(updatedRecord, cb) {
        console.log(updatedRecord);
    }
});


module.exports = stockCollection;